package org.sport.dbInterface;

import org.sport.model.entityModel.GrouptableEntity;
import org.sport.model.entityModel.LinkapplyhistoryEntity;
import org.sport.model.entityModel.UsertableEntity;

import java.util.List;

/**
 * Created by Allen on 2017/9/22.
 */
public interface LinAppHisOperation {

    /*
    * 增
    * */
    boolean         addOneApplyInfo(LinkapplyhistoryEntity linkapply);

    /*
    * 改
    * */

    /**
     * 更新User申请User的status
     * @param ApplyUser
     * @param BeApplyUser
     * @return
     */
    boolean         updateUserStatus(UsertableEntity ApplyUser,UsertableEntity BeApplyUser,String status);

    /**
     * 更新User申请Group状态，Group可以通过ownerId找寻到User进行状态修改
     * @param ApplyUser
     * @param BeApplyGroup
     * @return
     */
    boolean         updateGroupStatus(UsertableEntity ApplyUser, GrouptableEntity BeApplyGroup, String status);

    /*
    * 删
    * */
    boolean         delOneCheatInfo(LinkapplyhistoryEntity linkapply);

    /*
    * 查
    * */


    /**
     * 通过两个联系人确定唯一一条申请记录
     * @param ApplyUser
     * @param BeApplyUser
     * @return
     */
    LinkapplyhistoryEntity       findOneBy2User(UsertableEntity ApplyUser,UsertableEntity BeApplyUser);


    /**
     * 通过一个User和一个Group确定唯一一条申请记录
     * @param ApplyUser
     * @param BeApplyGroup
     * @return
     */
    LinkapplyhistoryEntity       findOneByUserAndGroup(UsertableEntity ApplyUser,GrouptableEntity BeApplyGroup);


    /**
     * 返回一个User   申请的所有记录
     * @param ApplyUser
     * @return
     */
    List<LinkapplyhistoryEntity> findByApplyUserId(UsertableEntity ApplyUser);

    /**
     * 返回一个User 被 申请的所有记录
     * @param BeApplyUser
     * @return
     */
    List<LinkapplyhistoryEntity> findByBeApplyUserId(UsertableEntity BeApplyUser);

    /**
     * 返回所有申请的记录
     * @return
     */
    List<LinkapplyhistoryEntity> findAllApplyAndBe();
}
